/**
 * Created by PanJiaChen on 16/11/18.
 */

/**
 * @param {string} path
 * @returns {Boolean}
 */
export function isExternal(path) {
  return /^(https?:|mailto:|tel:)/.test(path)
}

/**
 * @param {string} str
 * @returns {Boolean}
 */
export function validUsername(str) {
  const valid_map = ['admin', 'editor']
  return valid_map.indexOf(str.trim()) >= 0
}
export function valmobile(val) {
  const regmobile = /^1[3-9][0-9]{9}$/
  const ismobile = regmobile.test(val)
  return ismobile
}
export function valpassword(val) {
  const regpassword = /^[^\s]{6,16}$/
  const ispassword = regpassword.test(val)
  return ispassword
}
